from django.contrib.auth.backends import ModelBackend


class MyBackend(ModelBackend):

    def authenticate(self, request, username=None, password=None):
        # Check the username/password and return a user.

        print(username,password)
        # http_res.set_signed_cookie(
        #     'account', tmp_user.account, salt='os-easy', max_age=7 * 24 * 60 * 60)
        # http_res.set_signed_cookie(
        #     tmp_user.account, status_key, salt='os-easy', max_age=7 * 24 * 60 * 60)

        # # 写入缓存
        # cache.set(tmp_user.account, status_key, 7 * 24 * 60 * 60)

        return super().authenticate(request,username,password)    
